package com.atfcm.arr;

/**
 * @Author whaty
 * @create 2024/10/18 16:57
 */
public class t485 {
    public static void main(String[] args) {

    }


    /**
         * 边界：连续的1在数组结尾
     * @param nums
     * @return
     */
    public static int findMaxConsecutiveOnes(int[] nums) {
        int max = 0;
        int count = 0;
        boolean isOne = false;
        for (int i = 0; i < nums.length; i++) {
            if(nums[i] == 1){
                isOne = true;
                count++;
            }else {
                max = Math.max(count, max);
                isOne = false;
                count = 0;
            }
        }
        return count;
    }
}
